﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Text;
using BLL.SchemaDiscovery;

namespace SVC.SchemaDiscovery
{
    
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class SchemaService : ISchemaService
    {
        #region Implementation of ISchemaService

        public List<string> ListDatabaseServers()
        {
            return SqlServerManager.ListDbServers();
        }

        public List<string> ListDatabases(string serverName)
        {
            return SqlServerManager.ListDbs(serverName);
        }

        public List<string> ListDatabases2(string serverName, string userName, string password)
        {
            return SqlServerManager.ListDbs(serverName, userName, password);
        }

        public List<string> ListDbSchemas(string serverName, string dbName)
        {
            return SqlServerManager.ListDbSchemas(serverName, dbName);
        }

        public List<string> ListDbSchemas2(string serverName, string dbName, string userName, string password)
        {
            return SqlServerManager.ListDbSchemas(serverName, dbName, userName, password);
        }

        public List<string> ListTables(string serverName, string dbName, string schemaName)
        {
            return SqlServerManager.ListTables(serverName, dbName, schemaName);
        }

        public List<string> ListTables2(string serverName, string dbName, string userName, string password, string schemaName)
        {
            return SqlServerManager.ListTables(serverName, dbName, userName, password, schemaName);
        }

        public List<string> ListTableColumnNames(string serverName, string dbName, string schemaName, string tableName)
        {
            return SqlServerManager.ListTableColumnNames(serverName, dbName, schemaName, tableName);
        }

        public List<string> ListTableColumnNames2(string serverName, string dbName, string userName, string password, string schemaName, string tableName)
        {
            return SqlServerManager.ListTableColumnNames(serverName, dbName, userName, password, schemaName, tableName);
        }

        public List<string> ListTableColumnNamesUsingSQL(string serverName, string dbName, string sql)
        {
            return SqlServerManager.ListTableColumnNamesUsingSQL(serverName, dbName, sql);
        }

        public List<string> ListTableColumnNamesUsingSQL2(string serverName, string dbName, string userName, string password, string sql)
        {
            return SqlServerManager.ListTableColumnNamesUsingSQL(serverName, dbName, userName, password, sql);
        }

        public List<ColumnNameType> ListTableColumns(string serverName, string dbName, string schemaName, string tableName)
        {
            return SqlServerManager.ListTableColumns(serverName, dbName, schemaName, tableName);
        }

        public List<ColumnNameType> ListTableColumns2(string serverName, string dbName, string userName, string password, string schemaName, string tableName)
        {
            return SqlServerManager.ListTableColumns(serverName, dbName, userName, password, schemaName, tableName);
        }

        #endregion
    }
}
